import axios from 'axios'

const request = axios.create({
  baseURL: 'http://127.0.0.1:3000',
  timeout: 5000
})

// 请求拦截
request.interceptors.request.use(config => {
  return config
}, error => {
  // 出现异常
  return Promise.reject(error)
})

// 响应拦截
request.interceptors.response.use(response => {
  return response
}, error => {
  // 出现异常
  return Promise.reject(error)
})

// 导出request
export default request
